<?php
namespace app\mainadmin\controller;

use app\AdminController;


/**
 * 后台首页
 * Class Index
 * @package app\store\controller
 */
class Index extends AdminController
{
    protected function initialize()
    {
        $this->isCheckPriv = false;
        parent::initialize();
    }
    /*------------------------------------------------------ */
    //-- 默认首页，负责跳转
    /*------------------------------------------------------ */
    public function index()
    {
        $top_menus = reset($this->top_menus);
        $this->redirect($top_menus['module'].'/'.$top_menus['controller'].'/'.$top_menus['action']);
    }
    /*------------------------------------------------------ */
    //-- 清理全部缓存
    /*------------------------------------------------------ */
    public function clearCache()
    {
        $redis = new \think\cache\driver\Redis();
        $keysdata = $redis->keys(config('cache.prefix') . '*');
        foreach ($keysdata as $key => $val) {
            if (stripos($val, config('cache.prefix').'devlogin_') !== 0 && stripos($val, config('cache.prefix').'uniappLogin_') !== 0) {
                $redis->rm($val);
            }
        }
        return $this->success('清理完成.','/lzadmin.php');
    }

}
